import 'package:common/base/base_lv_adapter.dart';
import 'package:common/base/base_lv_state.dart';
import 'package:common/base/base_stateful_widget.dart';
import 'package:flutter/material.dart';
import 'package:home/mvp/model/my_page_list_bean.dart';
import 'package:resource/generated/l10n.dart';

class MyPage extends BaseStatefulWidget {
  const MyPage({super.key});

  @override
  State<MyPage> createState() => _MyPageState();
}

class _MyPageState extends BaseLvState<MyPage,MyPageListBean> {

  @override
  bool onNeedCachePage() {
    return true;
  }

  @override
  void onStateInit() {
    super.onStateInit();
    rxTitle.value = S.current.my;
  }

  @override
  bool onNeedBack() {
    return false;
  }


  @override
  BaseLvAdapter<MyPageListBean> onInitAdapter() {
    return BaseLvAdapter<MyPageListBean>((MyPageListBean t, int index) {
      return Container(
          margin: const EdgeInsets.fromLTRB(5, 0, 0, 0),
          child:createItemAndDataBind(t));
    });
  }

  Widget createItemAndDataBind(MyPageListBean item) {
    return Text(item.title);
  }


  @override
  void onLoadData() {}

  @override
  void onSuccess<D>(D d, String apiPath) {
    super.onSuccess(d, apiPath);
  }
}
